//存
export const setItem = (key, v) => {
        if (typeof v === 'object') {
            v = JSON.stringify(v)
        }
        // window.localStorage.setItem(key, v)
        localStorage.setItem(key, v)
    }
    //取
export const getItem = key => {
        // const data = window.localStorage.getItem(key)
        const data = localStorage.getItem(key)
        try {
            return JSON.parse(data)
        } catch (err) {
            console.log(err);
            return data
        }


    }
    //删除
export const removeItem = key => {
    window.localStorage.removeItem(key)
}